Skip to content

fix: preserve PERPLEXITY_BASE_URL query parameters when joining paths - #155

Open
qirh wants to merge 1 commit into
mainfrom
fix/base-url-query-path
Open

qirh wants to merge 1 commit into
mainfrom
fix/base-url-query-path

Conversation

@qirh

@qirh qirh commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

makeApiRequest builds the request URL as ${PERPLEXITY_BASE_URL}/${endpoint}, so a query string in PERPLEXITY_BASE_URL swallows the endpoint path: https://proxy.example.com/api/?key=x becomes https://proxy.example.com/api/?key=x/v1/agent.

This parses the base URL and appends the endpoint to its pathname, which keeps the base query intact and avoids a double slash when the base URL ends in /. Base URLs without a query or trailing slash produce the same URL as before.

Same issue as perplexityai/perplexity-py#139.

Validation: new test fails before the change and passes after. tsc --noEmit passes, and vitest run passes apart from proxyAwareFetch > should NOT use native fetch when proxy is configured, which also times out on main in my environment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants